Force spinners to be square
authorMatthias Clasen <mclasen@redhat.com>
Tue, 18 Sep 2012 02:47:36 +0000 (22:47 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 18 Sep 2012 02:47:36 +0000 (22:47 -0400)
gtk/gtkspinner.c

index 532ed07b331db5efa2a521cdc3bc4da0cc529e26..06840c88fe441b6674fae97de6a8be4f074583c6 100644 (file)
@@ -201,12 +201,19 @@ gtk_spinner_draw (GtkWidget *widget,
                   cairo_t   *cr)
 {
   GtkStyleContext *context;
+  gint width, height;
+  gint size;
 
   context = gtk_widget_get_style_context (widget);
 
-  gtk_render_activity (context, cr, 0, 0,
-                       gtk_widget_get_allocated_width (widget),
-                       gtk_widget_get_allocated_height (widget));
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+  size = MIN (width, height);
+
+  gtk_render_activity (context, cr,
+                       (width - size) / 2,
+                       (height - size) / 2,
+                       size, size);
 
   return FALSE;
 }